{extend	name="homepage"	/}
{block name="right"}
  <!-- content start -->
  <div class="admin-content">
    <div class="admin-content-body">
      <div class="am-cf am-padding am-padding-bottom-0">
        <div class="am-fl am-cf"><strong class="am-text-primary am-text-lg">个人资料</strong> / <small>Personal information</small></div>
      </div>

      <hr/>

      <div class="am-g">
        <div class="am-u-sm-12 am-u-md-4 am-u-md-push-8">
          

        </div>

        <div class="am-u-sm-12 am-u-md-8 am-u-md-pull-4">
          <!-- <form action="{:Url('admin/topicuser/user')}" class="am-form am-form-horizontal" enctype="multipart/form-data"	method="post">
            <div class="am-form-group">
              <label for="user-name" class="am-u-sm-3 am-form-label">话题名称 </label>
              <div class="am-u-sm-9">
                <input type="text" name="title" >
              </div>
            </div>

            <div class="am-form-group">
                <label for="user-name" class="am-u-sm-3 am-form-label">排序数字 </label>
                <div class="am-u-sm-9">
                  <input type="text" name="num" >
                </div>
              </div>

            <div class="am-form-group">
              <label for="user-name" class="am-u-sm-3 am-form-label">缩略图</label>
              <div class="am-u-sm-9">
                <input type="file" name="image" onchange="upImg(this)">
                <span id="img_show"></span>
              </div>
            </div>

            <div class="am-form-group">
              <label for="user-name" class="am-u-sm-3 am-form-label">简介 </label>
              <div class="am-u-sm-9">
                <input type="text" name="account" >
              </div>
            </div>
            <div class="am-form-group">
              <div class="am-u-sm-9 am-u-sm-push-3">
                <button type="submit" class="am-btn am-btn-primary" name="up">添加</button>
              </div>
            </div>
          </form> -->

          <form action="{:Url('home/diwu/diwu')}" method="post" enctype="multipart/form-data">
            <span >标题</span><input type="text" name="title" style="width:400px;height:30px;margin:10px 10px 10px 30px"><br>
            <span >选择话题</span><select name="topic" style="height:30px;margin:10px 10px 10px 30px">
                <option value="0">拍客</option>
                <option value="1">话题</option>
                <option value="2">活动</option>
            </select><br>
            <span >主题图片</span>
            <input type="file" name="img" onchange="upImg(this)" style="width:50px;height:30px;">
            <!-- <button style="width:80px;height:30px;background:green;margin-left:-70px;color:white">图片上传</button> -->
            <span id="img_show"></span>
            <!-- 加载编辑器的容器 -->
            <textarea id="container" name="content" type="text/plain" style="width:800px;height:600px;">
                这里写你的初始化内容
            </textarea>
            <!-- 配置文件 -->
            <script type="text/javascript" src="__STATIC__/UEditor/ueditor.config.js"></script>
            <!-- 编辑器源码文件 -->
            <script type="text/javascript" src="__STATIC__/UEditor/ueditor.all.js"></script>
            <!-- 实例化编辑器 -->
            <script type="text/javascript">
                var ue = UE.getEditor('container');
            </script>
            <input type="submit" name="up" value="发布">
        </form>
        </div>
      </div>
    </div>

    <footer class="admin-content-footer">
      <hr>
      <p class="am-padding-left">© 2014 AllMobilize, Inc. Licensed under MIT license.</p>
    </footer>

  </div>
  <script>
      function upImg(obj)
          {
          if( obj.value == "" ) {
              return;
          }
          var formdata = new FormData(); 
          //<input type="file" name="img" />
          formdata.append("img" , $(obj)[0].files[0]);//获取文件法二
          $.ajax({
              type : 'post',
              url : "{:Url('home/diwu/upload')}",
              data : formdata,
              cache : false,
              processData : false, // 不处理发送的数据，因为data值是Formdata对象，不需要对数据做处理
              contentType : false, // 不设置Content-type请求头
              success : function(ret){
                  var html='<span class="img_html">'
                      html+='<img src="'+ret+'" alt="" width="100px" height="100px">'
                      html+='<span onclick="delImg(this)" class="img_del">删除</span>'
                      html+='<input type="hidden" name="img[]" style="width:100px;" value="'+ret+'">'
                      html+='</span>'
                  $('#img_show').append(html);
              },
              error : function(){ }
          });

      }
      function delImg(obj){
          $(obj).parent().remove()
      }
  </script>
  <!-- content end -->
  {/block}

